class Solution {
public:
    bool checkAlmostEquivalent(string word1, string word2)
    {
        int hash[26];
        for (auto ch : word1)
        {
            hash[ch - 'a']++;
        }
        for (int i = 0; i < word2.size(); i++)
        {
            hash[word2[i] - 'a']--;
        }
        for (int i = 0; i < 26; i++)
        {
            if (abs(hash[i]) > 3)
            {
                return false;
            }
        }
        return true;
    }
};